<template>
	<view class="comp-list">
		<view class="comp-add" @tap="toComp">
			<view class="add"></view>
			<view>我要投诉</view>
		</view>
		<view class="h1">我的投诉</view>
		<view class="list">
			<view class="item" v-for="item,index in compList">
				<view>运单号：{{item.infoNo}}</view>
				<view class="time">{{item.createTime}}</view>
				<view>{{item.description}}</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onLoad,onShow
	} from "@dcloudio/uni-app"
	let id = ""
	onLoad((params) => {
		id = params.id
		console.log(id);
		getCompList()
		uni.setNavigationBarTitle({
			title:"我的投诉"
		})

	})
	onShow(()=>{
		getCompList()
	})
	const compList = ref([])
	async function getCompList() {
		let {
			rows
		} = await uni.$get("/prod-api/api/logistics-inquiry/logistics_complaint/my-list")
		compList.value = rows

	}

	function toComp() {
		uni.navigateTo({
			url: "/pages/expressComplain/expressComplain?id=" + id
		})
	}
</script>

<style lang="scss">
	.comp-list {
		.comp-add {
			display: flex;
			align-items: center;
			margin: 10px;
			font-size: 25rpx;

			.add {
				background-color: #2590f8;
				width: 30px;
				height: 30px;
				border-radius: 50%;
				background-image: url("/static/images/add.png");
				background-repeat: no-repeat;
				background-position: center;
				background-size: 50%;
				margin-right: 5px;

			}
		}

		.list {
			font-size: 24rpx;
			margin: 10px;

			.item {
				padding-top: 10px;
				view {
					height: 50rpx;
				}
				.time{
					color:#999;
				}
				border-bottom: 1px solid #ccc;
			}
		}
	}
</style>